$(function () {
   $.ajax({

        url: OA_SERVER_NAME+"cxf/noc/getnotice/getinfo",
        type:'get',
        dataType: 'json',
        contentType: 'application/json',
        data: { "ggid" : $.getUrlQueryValue('ggid') },
        success: function (data) {
        	$('#noticeDetailBody').html("");
        	//发布人名详情
        	$("#fbr").html(data.reponseInfo[0].departmentname);

        	//发布时间
        	$("#fbdate").html(data.reponseInfo[0].docvaliddate +'&nbsp'+'&nbsp'
                    +data.reponseInfo[0].docvalidtime);
        	//标题
        	$("#table_file").html(data.reponseInfo[0].docsubject);
        	//内容
        	$("#content").html(data.reponsetxt[0].doccontent);

        	//图片
			var img = $("<img/>");
			img.attr({
				//"src":FILE_DOWNLOAD_URL + fileNewName,

			});
			$("#content").before(img);
        	var downAllArr = new Array();
        	var fileCount = 0;
        	$.each(data.reponseExt,function(index,item){



        			fileCount++;
        			//附件
        			var $downLi = $('<li class="file-item"><a javascript="void(0)"></a></li>');
        			var $downA = $downLi.find("a");
        			$downA.html(item.imagefilename);
        			$downA.attr({
            			"href": item.downurl,
            			"download":item.imagefilename
    				});
            		downAllArr.push($downA);
            		$("#fileBody").append($downLi);

        	});
        	//附件显示情况
        	$('#fileCount').html(fileCount == 0 ? '无':fileCount);
        	if(fileCount == 0){
                $('.file-list .dropdown-menu').css({
                    'display':'none'
                });
        	   $('#downAll').hide();
        	}

			$('#downAll').click(function(){

				$.each(downAllArr, function(index, item){
					window.open(item.attr('href'));
				});
			});
        }
    });
    /*页面高度*/
    $('.file-list .dropdown-toggle').click(function(){
        var _h = $('.notice-moudle').outerHeight();
        var add_h = $('.file-list .dropdown-menu').outerHeight();
        if($('.file-list').hasClass('open')){
            $('.notice-moudle').css('height',_h-add_h+'px');
        }else{
            $('.notice-moudle').css('height',_h+add_h+'px');
        }
    });
});
